package com.dbh.company.buildbook.image;

import cn.hutool.core.convert.Convert;
import cn.hutool.core.io.FileUtil;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * @author dongbanghui
 * @date 2025/5/8
 */
@Slf4j
public class CoverImage {

    public static void main(String[] args) {
        String str = "https://img.ljcdn.com/twin-model/prod-ec09f8f2-24c9-4088-afd0-4af9a7aac8d9.jpg," +
                "https://img.ljcdn.com/twin-model/prod-bc816336-62ba-4990-a54f-66036c1fcf3a.jpg," +
                "https://img.ljcdn.com/twin-model/prod-ef0265ed-59c9-4f76-8193-f4e3ac8faa8e.jpg," +
                "https://img.ljcdn.com/twin-model/prod-6b4ce5ae-670c-45d5-b5ed-d4e3e4668e20.jpg," +
                "https://img.ljcdn.com/twin-model/prod-ff2586d9-7d39-44c6-8a2c-6c28af06a8c6.jpg," +
                "https://img.ljcdn.com/twin-model/prod-1aa20647-6212-4b80-a4a8-11cd8af7cc4e.jpg," +
                "https://img.ljcdn.com/twin-model/prod-2b2cf98e-48c2-470d-96c8-0e7418051c5e.jpg," +
                "https://img.ljcdn.com/twin-model/prod-d0e0e7da-7a7c-4fac-a141-f2d1fc2b3f4b.jpg," +
                "https://img.ljcdn.com/twin-model/prod-2d76a7e1-752c-4723-9817-6c82e5f43cc3.jpg," +
                "https://img.ljcdn.com/twin-model/prod-e0e10d76-10dc-492b-bb1b-02d7a3115786.jpg," +
                "https://img.ljcdn.com/twin-model/prod-915b4711-420c-4369-8bc0-068b18b1911a.jpg," +
                "https://img.ljcdn.com/twin-model/prod-69cdfc9b-450c-47e7-9aec-0d5e3156ef95.jpg," +
                "https://img.ljcdn.com/twin-model/prod-59324ea7-13be-4cbb-bb0d-a8e9887b8af9.jpg," +
                "https://img.ljcdn.com/twin-model/prod-3a3f86f7-7eab-4ad1-bf76-bc69545e77f4.jpg," +
                "https://img.ljcdn.com/twin-model/prod-9cfbad7c-2259-4600-a899-a22dbb2d5aa2.jpg," +
                "https://img.ljcdn.com/twin-model/prod-2171116b-909d-4255-aa51-9d26c8bf8d66.jpg," +
                "https://img.ljcdn.com/twin-model/prod-d35d4282-bafc-4528-b665-4e65977e832e.jpg," +
                "https://img.ljcdn.com/twin-model/prod-a5b80c07-e99f-4e5c-b8a4-2c927d07a246.jpg," +
                "https://img.ljcdn.com/twin-model/prod-0f3fad4d-becb-40e8-8212-1fc6eb8be0f0.jpg," +
                "https://img.ljcdn.com/twin-model/prod-c7b4810b-bf2e-4ff2-8766-101e66657793.jpg," +
                "https://img.ljcdn.com/twin-model/prod-4c65cdb5-984e-406f-b230-00c65f3b60a8.jpg," +
                "https://img.ljcdn.com/twin-model/prod-0956502b-1edb-43d5-88d8-7ef0af4305bf.jpg," +
                "https://img.ljcdn.com/twin-model/prod-06f51b48-7cf6-49fc-8a38-0233bf12be3b.jpg," +
                "https://img.ljcdn.com/twin-model/prod-f1a961d0-53f5-49fa-a7b3-c34ba4904f35.jpg," +
                "https://img.ljcdn.com/twin-model/prod-66cdc162-ecc5-455a-a56f-806132ced3d7.jpg," +
                "https://img.ljcdn.com/twin-model/prod-c359cd2d-ff56-426f-a7d5-0457a8c423da.jpg," +
                "https://img.ljcdn.com/twin-model/prod-21b544e0-2855-490e-8299-64036e43cdda.jpg," +
                "https://img.ljcdn.com/twin-model/prod-fd84ea8f-e2f6-4498-83c0-68bc369f4a86.jpg," +
                "https://img.ljcdn.com/twin-model/prod-2f961c85-370e-4468-9852-4f69a3aae7d8.jpg," +
                "https://img.ljcdn.com/twin-model/prod-e8f26f79-2755-4683-9461-f15cb9d1b099.jpg," +
                "https://img.ljcdn.com/twin-model/prod-ac9d28e3-a026-4cf5-b983-dbc357fe12b0.jpg," +
                "https://img.ljcdn.com/twin-model/prod-dd7fbdc5-f584-483d-b7d5-cb02cf531a94.jpg," +
                "https://img.ljcdn.com/twin-model/prod-5e386d25-5ad9-48ec-9635-67cff5e31046.jpg," +
                "https://img.ljcdn.com/twin-model/prod-c7542e75-f4c6-4732-bc46-34767ab65d2d.jpg," +
                "https://img.ljcdn.com/twin-model/prod-68150c90-47e5-444a-a78e-2d8772486693.jpg," +
                "https://img.ljcdn.com/twin-model/prod-55fecce0-26b1-4878-a615-afe0a89d6e92.jpg," +
                "https://img.ljcdn.com/twin-model/prod-a0d546af-63cc-445a-96d9-2deb8ee261f3.jpg," +
                "https://img.ljcdn.com/twin-model/prod-443a6758-3667-4620-96b5-0a549df29bd7.jpg," +
                "https://img.ljcdn.com/twin-model/prod-e5a4eedf-db4f-4b1b-be3d-26559167654c.jpg," +
                "https://img.ljcdn.com/twin-model/prod-7c005ff7-fda4-4323-97e9-b255ff08cec8.jpg," +
                "https://img.ljcdn.com/twin-model/prod-eea1f5c7-dfb4-430d-9563-e76ec0d2e27f.jpg," +
                "https://img.ljcdn.com/twin-model/prod-f05ccd7f-48d5-423f-9186-5853ad89f9d5.jpg," +
                "https://img.ljcdn.com/twin-model/prod-a77187f9-1342-4924-b991-27936d514e97.jpg," +
                "https://img.ljcdn.com/twin-model/prod-65dcd8f0-59b8-4788-9eee-9da610c332e8.jpg," +
                "https://img.ljcdn.com/twin-model/prod-9944bfb9-67ab-4102-84a1-ec0ab1e71e58.jpg," +
                "https://img.ljcdn.com/twin-model/prod-237b6ca7-2df5-45ad-9190-295e2686528d.jpg," +
                "https://img.ljcdn.com/twin-model/prod-d6c977c7-ad95-452f-8065-a97ef6569c31.jpg," +
                "https://img.ljcdn.com/twin-model/prod-52fb1334-c3f8-477d-9874-d4d6ff564869.jpg," +
                "https://img.ljcdn.com/twin-model/prod-32d6150b-9832-44f6-baaa-8dbe53f021ea.jpg," +
                "https://img.ljcdn.com/twin-model/prod-61e51efe-5423-45b2-a146-a030fcb0e863.jpg," +
                "https://img.ljcdn.com/twin-model/prod-f0e450c9-3d69-4f78-a95e-ce1bf93d9104.jpg," +
                "https://img.ljcdn.com/twin-model/prod-d1498745-239c-481d-abf0-81824aad032a.jpg," +
                "https://img.ljcdn.com/twin-model/prod-2e69e0d5-2742-4882-bb73-24ec3cf8e1b5.jpg," +
                "https://img.ljcdn.com/twin-model/prod-841ef8f3-f3c3-453b-93fc-7ee500f80f1c.jpg," +
                "https://img.ljcdn.com/twin-model/prod-81a58a67-9298-4958-903f-305165f95b10.jpg," +
                "https://img.ljcdn.com/twin-model/prod-99d5ae60-8b13-4a4e-bcc4-d30eff308c1d.jpg," +
                "https://img.ljcdn.com/twin-model/prod-7a048347-0195-4aae-846d-94579201eb48.jpg," +
                "https://img.ljcdn.com/twin-model/prod-84a4ac67-b046-424a-8f04-464b9a5da673.jpg," +
                "https://img.ljcdn.com/twin-model/prod-a9a23894-fca1-4168-b6b8-8352a23398cb.jpg," +
                "https://img.ljcdn.com/twin-model/prod-bd19a4b5-1824-43fa-9644-79f7df8125c0.jpg," +
                "https://img.ljcdn.com/twin-model/prod-161a1efa-6803-441e-bf1d-fe89a98bd25e.jpg," +
                "https://img.ljcdn.com/twin-model/prod-d9a56fd0-49e6-45b6-8465-242991071d6b.jpg," +
                "https://img.ljcdn.com/twin-model/prod-c7121b94-7270-4f4b-a862-0e537b2cd870.jpg," +
                "https://img.ljcdn.com/twin-model/prod-de015165-87e6-4e55-9d14-658f0e3668cc.jpg," +
                "https://img.ljcdn.com/twin-model/prod-46e66be8-b9d7-4cb0-8c7b-0828b5ea9e5e.jpg," +
                "https://img.ljcdn.com/twin-model/prod-fcfe254c-b913-4b7a-a86e-c036b4b73020.jpg," +
                "https://img.ljcdn.com/twin-model/prod-3212e1a0-5ee0-4c9d-83a4-56ba9fb51d99.jpg," +
                "https://img.ljcdn.com/twin-model/prod-acb16b96-2712-4701-84fd-05669381003a.jpg," +
                "https://img.ljcdn.com/twin-model/prod-2fb14e5f-5b4d-40b8-a1c8-a8b422960375.jpg," +
                "https://img.ljcdn.com/twin-model/prod-c37ba907-0ecb-4130-bce3-e27eed8d70d8.jpg," +
                "https://img.ljcdn.com/twin-model/prod-b7849a39-ae5d-47e1-89c9-83db5f9cb283.jpg," +
                "https://img.ljcdn.com/twin-model/prod-fb1ff00d-d736-4d69-9869-598b18b0bf8c.jpg," +
                "https://img.ljcdn.com/twin-model/prod-1d215152-88c2-40fc-8ee6-109043d1f484.jpg," +
                "https://img.ljcdn.com/twin-model/prod-c0a16de3-0339-4670-99c6-b5a8523283db.jpg," +
                "https://img.ljcdn.com/twin-model/prod-911b1f17-573f-4627-bd41-73b9cb6261b1.jpg," +
                "https://img.ljcdn.com/twin-model/prod-afacd743-fe3f-43bc-955b-9e31075703ec.jpg," +
                "https://img.ljcdn.com/twin-model/prod-086eeeda-3c31-416d-9f80-dd766566a618.jpg," +
                "https://img.ljcdn.com/twin-model/prod-ec8724c0-72f6-4aa3-ab2b-a46382408d2b.jpg," +
                "https://img.ljcdn.com/twin-model/prod-3d3c93d6-b8db-4285-9474-4c5a426efd71.jpg," +
                "https://img.ljcdn.com/twin-model/prod-bef656f3-835a-41ea-85f1-faa804804839.jpg," +
                "https://img.ljcdn.com/twin-model/prod-80d9806e-c17c-48c3-8864-3ae64fc81110.jpg," +
                "https://img.ljcdn.com/twin-model/prod-86906708-22f2-4d7a-9680-8ba33c9c24ef.jpg," +
                "https://img.ljcdn.com/twin-model/prod-9b9a0746-aee1-443e-aed1-e81e93b62f86.jpg," +
                "https://img.ljcdn.com/twin-model/prod-4aade8be-825f-477a-843d-7dcc00c242b6.jpg," +
                "https://img.ljcdn.com/twin-model/prod-30bffca6-5460-4c6b-8cd2-0949dbadbcca.jpg," +
                "https://img.ljcdn.com/twin-model/prod-d12adc2f-0f5b-46a9-a8f8-24ac71de26f8.jpg," +
                "https://img.ljcdn.com/twin-model/prod-433c8ff6-dabe-4965-bea4-c424be6170e7.jpg," +
                "https://img.ljcdn.com/twin-model/prod-45a61696-2275-4db0-9696-ff6bb813ac6f.jpg," +
                "https://img.ljcdn.com/twin-model/prod-93665aef-e946-4c3f-806d-d5b166fbc261.jpg," +
                "https://img.ljcdn.com/twin-model/prod-fdfaf2f8-45a6-41a2-9ffb-7c6301cc99d6.jpg," +
                "https://img.ljcdn.com/twin-model/prod-e302122f-3d23-4235-a2d5-a22e74fb186b.jpg," +
                "https://img.ljcdn.com/twin-model/prod-f8257067-ac22-4a60-a72f-4ad93e46fa56.jpg," +
                "https://img.ljcdn.com/twin-model/prod-6e0624b5-3db2-4169-9047-e65c9e5940df.jpg," +
                "https://img.ljcdn.com/twin-model/prod-3ec195fc-e63b-44c3-b49e-40fb7424bce5.jpg," +
                "https://img.ljcdn.com/twin-model/prod-3e3eef9d-fcd2-4775-9fb4-9fb5cb5a038e.jpg," +
                "https://img.ljcdn.com/twin-model/prod-0a60649c-df12-47e0-a3fe-0ed52375cb60.jpg," +
                "https://img.ljcdn.com/twin-model/prod-1f286eae-2041-41a2-bd92-979934929233.jpg," +
                "https://img.ljcdn.com/twin-model/prod-b3a11ec4-9e73-4613-af55-af1ec3f2552b.jpg," +
                "https://img.ljcdn.com/twin-model/prod-712a4c9f-12aa-4c42-b88d-2beeb643e836.jpg," +
                "https://img.ljcdn.com/twin-model/prod-5d2aaa8b-2b8c-4aeb-ae5b-8c3781df4211.jpg," +
                "https://img.ljcdn.com/twin-model/prod-d7a9b2a7-5cea-4ba8-9841-5052ba709246.jpg," +
                "https://img.ljcdn.com/twin-model/prod-fd7ca589-c4e0-4b19-919f-9594322209e8.jpg," +
                "https://img.ljcdn.com/twin-model/prod-268433c8-ed53-49c0-9e43-d18738565654.jpg," +
                "https://img.ljcdn.com/twin-model/prod-b20a0bcd-b3d7-43b8-97a2-c83ec0fcf1bb.jpg," +
                "https://img.ljcdn.com/twin-model/prod-afb1ee77-151a-41a8-a2cd-6b467e807b56.jpg," +
                "https://img.ljcdn.com/twin-model/prod-49be360d-dca6-417e-9881-60bfd2325a00.jpg," +
                "https://img.ljcdn.com/twin-model/prod-e3ee487c-5f67-4abc-ab5a-2e152c41a9ac.jpg," +
                "https://img.ljcdn.com/twin-model/prod-b9c4f6ba-bf1d-4ee0-a470-62724b52de89.jpg," +
                "https://img.ljcdn.com/twin-model/prod-de9ae8e8-a078-4042-8a48-cd918fe70639.jpg," +
                "https://img.ljcdn.com/twin-model/prod-9a9bd713-e85a-426c-b565-bc29d46e1861.jpg," +
                "https://img.ljcdn.com/twin-model/prod-d98a63a6-1337-4434-90c4-68b55fc38153.jpg," +
                "https://img.ljcdn.com/twin-model/prod-329fe785-6771-4db0-a23d-06f8775c9640.jpg," +
                "https://img.ljcdn.com/twin-model/prod-eb84081e-77ef-4820-9a41-1966f2092aad.jpg," +
                "https://img.ljcdn.com/twin-model/prod-16bf224e-47e8-477e-b1a5-cfa88cea1808.jpg," +
                "https://img.ljcdn.com/twin-model/prod-c558d4a0-f67d-4d35-b5c5-3ce7b49efbab.jpg," +
                "https://img.ljcdn.com/twin-model/prod-e4e6adc2-238f-44e4-9076-dd449cb0f943.jpg," +
                "https://img.ljcdn.com/twin-model/prod-39d00c8a-1768-40d8-bbf5-d8d6a78f49e5.jpg," +
                "https://img.ljcdn.com/twin-model/prod-45cff6bc-0370-4d38-b266-569264eb7a23.jpg," +
                "https://img.ljcdn.com/twin-model/prod-209af21d-e9a9-4d75-830f-5084a8b0350e.jpg," +
                "https://img.ljcdn.com/twin-model/prod-5a35761c-c2d3-423f-9db5-064725a561c0.jpg," +
                "https://img.ljcdn.com/twin-model/prod-316e41d1-d2ec-44dc-b06c-d39d0eb48fe9.jpg," +
                "https://img.ljcdn.com/twin-model/prod-c7595630-33f6-49ef-858d-b76944b118ad.jpg," +
                "https://img.ljcdn.com/twin-model/prod-278d6f02-e06f-44b1-87aa-8a0468c2205a.jpg," +
                "https://img.ljcdn.com/twin-model/prod-7a00e50f-031b-4b0c-9d9c-b5e0ca308646.jpg," +
                "https://img.ljcdn.com/twin-model/prod-89d09694-202a-4d8b-ba6d-7dd66759e289.jpg," +
                "https://img.ljcdn.com/twin-model/prod-c9b5becd-0f17-4a62-991d-984a3d5e1b02.jpg," +
                "https://img.ljcdn.com/twin-model/prod-291854d4-0899-447f-bcce-b7254507959b.jpg," +
                "https://img.ljcdn.com/twin-model/prod-5e18a406-5a01-4abe-9cc7-e2eda868a352.jpg," +
                "https://img.ljcdn.com/twin-model/prod-fd0f58c3-098a-4be0-abff-00b6c79cf9ec.jpg," +
                "https://img.ljcdn.com/twin-model/prod-217d0635-df09-46be-9376-8f92d7e24067.jpg," +
                "https://img.ljcdn.com/twin-model/prod-9e965569-c8f1-4ae3-b838-73c845d8bfc8.jpg," +
                "https://img.ljcdn.com/twin-model/prod-6b21bade-2560-44b1-aa78-9a572631d388.jpg," +
                "https://img.ljcdn.com/twin-model/prod-bb071988-f815-4167-a159-cf773659e371.jpg," +
                "https://img.ljcdn.com/twin-model/prod-b53343d0-34cf-427e-b4ba-a0d4b510794d.jpg," +
                "https://img.ljcdn.com/twin-model/prod-b40b7229-0dcb-46c2-8651-c87e1d955767.jpg," +
                "https://img.ljcdn.com/twin-model/prod-6d193e48-42d9-4b6f-92bc-e1719257a336.jpg," +
                "https://img.ljcdn.com/twin-model/prod-13f8a441-1d77-417c-8294-19e96c926cf4.jpg," +
                "https://img.ljcdn.com/twin-model/prod-837b04cc-620c-42d0-8395-7687410c3a9f.jpg," +
                "https://img.ljcdn.com/twin-model/prod-40f3819f-609f-45fa-8e51-69cbbdc26d47.jpg," +
                "https://img.ljcdn.com/twin-model/prod-b1dfb2a8-7872-4b99-b58f-f973a56871af.jpg," +
                "https://img.ljcdn.com/twin-model/prod-10c0daca-2918-42d0-8239-1b510cd767e1.jpg," +
                "https://img.ljcdn.com/twin-model/prod-12db95ba-5ae8-47c5-9128-7bf0ccbe9317.jpg," +
                "https://img.ljcdn.com/twin-model/prod-6e563c21-6bee-4953-bdd8-b46fd52f6510.jpg," +
                "https://img.ljcdn.com/twin-model/prod-a3563728-1c96-4b1e-8d01-8cb3587575d0.jpg," +
                "https://img.ljcdn.com/twin-model/prod-e9ddee46-37c2-4533-b3ab-18f49849fbb8.jpg," +
                "https://img.ljcdn.com/twin-model/prod-254033ca-d9b2-462b-8b21-877a58d14b49.jpg," +
                "https://img.ljcdn.com/twin-model/prod-d2373d02-d9a5-4b7e-bd46-f52e0f8ac37c.jpg," +
                "https://img.ljcdn.com/twin-model/prod-b90b1df6-353e-408b-abb0-28916c4e3277.jpg," +
                "https://img.ljcdn.com/twin-model/prod-ba4e3cbb-1d1a-4c60-9056-280be6b4b2c4.jpg," +
                "https://img.ljcdn.com/twin-model/prod-41522077-61f4-4874-9b0e-6d56953e7133.jpg," +
                "https://img.ljcdn.com/twin-model/prod-25c07001-bb5d-46d9-9068-160c9bf4ca9f.jpg," +
                "https://img.ljcdn.com/twin-model/prod-6e499c9f-adc9-4f45-8c11-f80de79f9cfc.jpg," +
                "https://img.ljcdn.com/twin-model/prod-59c79d2f-dbfb-4231-bc03-1b3ddae8e42e.jpg," +
                "https://img.ljcdn.com/twin-model/prod-6899be31-bcf7-4685-ab07-f0dd1b663ee8.jpg," +
                "https://img.ljcdn.com/twin-model/prod-6949a2cc-b7a7-44a6-b567-6d1eaaf1fdc5.jpg," +
                "https://img.ljcdn.com/twin-model/prod-66955fa1-e305-4aa1-8309-9c43a20306ce.jpg," +
                "https://img.ljcdn.com/twin-model/prod-4f9ea69c-9556-4141-8b80-d7de847ebac2.jpg," +
                "https://img.ljcdn.com/twin-model/prod-6081624c-37bc-45d4-b687-2171444f2125.jpg," +
                "https://img.ljcdn.com/twin-model/prod-8004482f-f479-42a3-ae30-d08824206b65.jpg," +
                "https://img.ljcdn.com/twin-model/prod-13be2e73-e204-4fa5-80b2-1f5b2d5fea44.jpg," +
                "https://img.ljcdn.com/twin-model/prod-be2a0dd2-891b-471b-a4f8-efca1ed911ba.jpg," +
                "https://img.ljcdn.com/twin-model/prod-621ff69c-4a78-41bb-a1ca-585a37fe8cd4.jpg," +
                "https://img.ljcdn.com/twin-model/prod-4ebaa5e8-79f8-4335-9d3f-37d92aee636b.jpg," +
                "https://img.ljcdn.com/twin-model/prod-d47690e8-c613-4563-a4b4-306e5f6d3c34.jpg," +
                "https://img.ljcdn.com/twin-model/prod-ae852e84-9edc-4958-ad73-845c28ea73dc.jpg," +
                "https://img.ljcdn.com/twin-model/prod-0e7f5b91-c26a-481b-a05c-cc0443cff39f.jpg";

        String[] split = str.split(",");
        int i = 0;
        for (String  s : split) {
            i++;
            try {
                HttpUtil.downloadFile(s, FILE_PATH + "/" + i + ".jpg");
            } catch (Exception e) {
            }
        }

    }

    public static final String DOMAIN = "https://buildinghouse.ke.com";
    public static String  FILE_PATH = "D:\\data\\workspace\\file\\test\\image\\l3\\已上线";

    public static void downloadL2CoverImage() {
        String responseBody = HttpRequest.post(DOMAIN + "/test/get/l2/cover/url")
                .execute()
                .body();
        Object dataObj = JSONUtil.parseObj(responseBody).get("data");
        JSONArray objectArr = JSONUtil.parseArray(dataObj);
        AtomicInteger count = new AtomicInteger();
        String filePath = "D:\\data\\workspace\\file\\test\\image\\l2\\已上线";
        objectArr.forEach(item -> {
            JSONObject jsonObject = JSONUtil.parseObj(item);
            String coverUrl = Convert.toStr(jsonObject.get("coverUrl"));
            String resblockId = Convert.toStr(jsonObject.get("resblockId"));
            String stateStr = Convert.toStr(jsonObject.get("stateStr"));
            String id = Convert.toStr(jsonObject.get("id"));
            if ("已上线".equals(stateStr)) {
                count.getAndIncrement();
                System.out.println(count + "  " + "resblockId: " + resblockId + ", coverUrl: " + coverUrl);
                String fileName = resblockId + "-" + id + "-" + stateStr + ".jpg";
                HttpUtil.downloadFile(coverUrl, filePath + "/" + fileName);
            }
        });
    }

    public static void downloadL3CoverImage() {
        String responseBody = HttpRequest.post(DOMAIN + "/test/get/l3/cover/url")
                .execute()
                .body();
        Object dataObj = JSONUtil.parseObj(responseBody).get("data");
        JSONArray objectArr = JSONUtil.parseArray(dataObj);
        AtomicInteger count = new AtomicInteger();

        // 创建一个固定大小的线程池
        ExecutorService executorService = Executors.newFixedThreadPool(10); // 线程池大小可以根据需要调整

        objectArr.forEach(item -> {
            JSONObject jsonObject = JSONUtil.parseObj(item);
            String coverUrl = Convert.toStr(jsonObject.get("coverUrl"));
            String resblockId = Convert.toStr(jsonObject.get("resblockId"));
            String stateStr = Convert.toStr(jsonObject.get("stateStr"));
            String id = Convert.toStr(jsonObject.get("id"));

            if ("已上线".equals(stateStr)) {
                executorService.submit(() -> {
                    int currentCount = count.incrementAndGet();
                    System.out.println(currentCount + "  " + "resblockId: " + resblockId + ", coverUrl: " + coverUrl);
                    String fileName = resblockId + "-" + id + "-" + stateStr + ".jpg";
                    HttpUtil.downloadFile(coverUrl, FILE_PATH + "/" + fileName);
                });
            }
        });

        // 关闭线程池
        executorService.shutdown();
    }


}
